<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>教师课表信息管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
            $("#searchForm").validate({
                submitHandler: function(form){
                    loading('正在查询，请稍等...');
                    // var schoolYear = document.getElementById("schoolYear").value;
                    // if (schoolYear != "") {
                    //     document.getElementById("schoolYear").value = schoolYear + "-01-01";
                    // }
                    form.submit();
                }
            });
			$("#btnImport").click(function(){
				var teacherId = document.getElementById("teacherId").value;
				if (teacherId != "") {
					$.jBox($("#importBox").html(), {title:"导入数据", buttons:{"关闭":true},
						bottomText:"导入文件不能超过5M，仅允许导入“xls”或“xlsx”格式文件！"});
				} else {
					top.$.jBox.tip("组织机构请选择教师节点，才可导入课表信息!");
				}
			});
        });
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</head>
<body>
	<div id="importBox" class="hide">
		<form id="importForm" action="${ctx}/biz/bizTeacherTimetable/import" method="post" enctype="multipart/form-data"
			  class="form-search" style="padding-left:20px;text-align:center;" onsubmit="loading('正在导入，请稍等...');"><br/>
			<input id="uploadFile" name="file" type="file" style="width:330px"/><br/><br/>
			<input id="teacherId" name="teacherId" type="hidden" value="${bizTeacherTimetable.teacherId}"/>
			<input id="btnImportSubmit" class="btn btn-primary" type="submit" value="   导    入   "/>
			<a href="${ctx}/biz/bizTeacherTimetable/import/template">下载模板</a>
		</form>
	</div>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/biz/bizTeacherTimetable/">教师课表信息列表</a></li>
		<shiro:hasPermission name="biz:bizTeacherTimetable:edit">
			<li>
				<a href="${ctx}/biz/bizTeacherTimetable/form?teacherId=${bizTeacherTimetable.teacherId}">教师课表信息添加</a>
			</li>
		</shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="bizTeacherTimetable" action="${ctx}/biz/bizTeacherTimetable/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>学年：</label>
				<input name="schoolYear" id="schoolYear" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
					  value="${bizTeacherTimetable.schoolYear}"
					   onclick="WdatePicker({dateFmt:'yyyy',isShowClear:true});"/>
			</li>
			<li><label>星期几：</label>
				<form:select path="weekday" class="input-medium">
					<form:option value="" label=""/>
					<form:options items="${fns:getDictList('weekday')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
			</li>
			<li><label>班级名称：</label>
				<form:input path="className" htmlEscape="false" maxlength="255" class="input-medium"/>
			</li>
			<li><label>课程名称：</label>
				<form:input path="courseName" htmlEscape="false" maxlength="255" class="input-medium"/>
			</li>
			<li class="btns">
				<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
				<input id="btnImport" class="btn btn-primary" type="button" value="导入"/>
			</li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>学年</th>
				<th>学期</th>
				<th>学周开始</th>
				<th>学周结束</th>
				<th>星期几</th>
				<th>课节</th>
				<th>课程名称</th>
				<th>上课班级</th>
				<th>上课教师</th>
				<th>上课地址</th>
				<shiro:hasPermission name="biz:bizTeacherTimetable:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="bizTeacherTimetable">
			<tr>
				<td>${bizTeacherTimetable.schoolYear}</td>
				<td>${fns:getDictLabel(bizTeacherTimetable.term, 'term', '无')}</td>
				<td>${fns:getDictLabel(bizTeacherTimetable.weekStart, 'week', '无')}</td>
				<td>${fns:getDictLabel(bizTeacherTimetable.weekEnd, 'week', '无')}</td>
				<td>${fns:getDictLabel(bizTeacherTimetable.weekday, 'weekday', '无')}</td>
				<td>${fns:getDictLabel(bizTeacherTimetable.section, 'section', '无')}</td>
				<td><a href="${ctx}/biz/bizTeacherTimetable/form?id=${bizTeacherTimetable.id}">${bizTeacherTimetable.courseName}</a></td>
				<td>${bizTeacherTimetable.className}</td>
				<td>${bizTeacherTimetable.teacherName}</td>
				<td>${bizTeacherTimetable.address}</td>
				<shiro:hasPermission name="biz:bizTeacherTimetable:edit"><td>
    				<a href="${ctx}/biz/bizTeacherTimetable/form?id=${bizTeacherTimetable.id}">修改</a>
					<a href="${ctx}/biz/bizTeacherTimetable/delete?id=${bizTeacherTimetable.id}" onclick="return confirmx('确认要删除该教师课表信息吗？', this.href)">删除</a>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>